package com.naire.modul.dictype.action;

import java.util.ArrayList;
import java.util.List;

import net.common.action.GeneralAction;
import com.naire.modul.dictype.service.DictypeDeleteService;
import com.naire.modul.dictype.service.DictypeEditorService;
import com.naire.modul.dictype.service.DictypeFindService;
import com.naire.modul.dictype.service.DictypeSearchService;
import com.naire.modul.dictype.vo.DictypeVo;

public class DictypeAction extends GeneralAction {

	private static final long serialVersionUID = 7127573666355745443L;

	private DictypeVo bean = new DictypeVo();
	private List<DictypeVo> list = new ArrayList<DictypeVo>();
	
	public String search() throws Exception {
		DictypeSearchService service = new DictypeSearchService();
		service.setPageBean(pageBean);
		service.invoke();
		list = service.getList();
		return SUCCESS;
	}
	
	public String editor() throws Exception {
		DictypeEditorService service = new DictypeEditorService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}
	
	public String find() throws Exception {
		if(bean.getDict_sort_id() != null) {			
			DictypeFindService service = new DictypeFindService();
			service.setId(bean.getDict_sort_id());
			service.invoke();
			bean = service.getBean();
		}
		return SUCCESS;
	}
	
	public String delete() throws Exception {
		DictypeDeleteService service = new DictypeDeleteService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}
	
	public DictypeVo getBean() {
		return bean;
	}
	public void setBean(DictypeVo bean) {
		this.bean = bean;
	}
	public List<DictypeVo> getList() {
		return list;
	}
	public void setList(List<DictypeVo> list) {
		this.list = list;
	}
}
